#!/bin/bash
#========================================================================
# Author: YSLin
# Email: 
# File Name: uncompress.sh
# Description: 
#   如何將sh檔案中附加其他檔案然後再利用tail取出來
# Edit History: 
#   2011-04-15    File created.
#========================================================================
#請勿執行
#Download DbVisualizer 7.1.5
#http://www.dbvis.com/products/dbvis/download/
#dbvis_linux_7_1_5.sh 中看到的code,將壓縮檔放在sh中,利用tail來取得檔案再解壓縮
trap 'cd "$old_pwd"; rm -R -f "$sfx_dir_name"; exit 1' HUP INT QUIT TERM
tail -c 1102300 "$prg_dir/${progname}" > sfx_archive.tar.gz 2> /dev/null
if [ "$?" -ne "0" ]; then
	tail -1102300c "$prg_dir/${progname}" > sfx_archive.tar.gz 2> /dev/null
	if [ "$?" -ne "0" ]; then
		echo "tail didn't work. This could be caused by exhausted disk space. Aborting."
		returnCode=1
		cd "$old_pwd"
		if [ ! "W $INSTALL4J_KEEP_TEMP" = "W yes" ]; then
			rm -R -f "$sfx_dir_name"
		fi
		exit $returnCode
	fi
fi
gunzip sfx_archive.tar.gz

